/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.buanalintas.sandals.pos.entities;

import com.buanalintas.bynga.entities.MasterUnit;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author user
 */
@Entity
@Table(name = "pos_master_payment")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PosMasterPayment.findAll", query = "SELECT p FROM PosMasterPayment p"),
    @NamedQuery(name = "PosMasterPayment.findBySync", query = "SELECT p FROM PosMasterPayment p WHERE p.sync = :sync"),
    @NamedQuery(name = "PosMasterPayment.findByPaymentId", query = "SELECT p FROM PosMasterPayment p WHERE p.paymentId = :paymentId"),
    @NamedQuery(name = "PosMasterPayment.findByPaymentDebit", query = "SELECT p FROM PosMasterPayment p WHERE p.paymentDebit = :paymentDebit"),
    @NamedQuery(name = "PosMasterPayment.findByPaymentKredit", query = "SELECT p FROM PosMasterPayment p WHERE p.paymentKredit = :paymentKredit"),
    @NamedQuery(name = "PosMasterPayment.findByPaymentDeposit", query = "SELECT p FROM PosMasterPayment p WHERE p.paymentDeposit = :paymentDeposit"),
    @NamedQuery(name = "PosMasterPayment.findByPaymentOutstanding", query = "SELECT p FROM PosMasterPayment p WHERE p.paymentOutstanding = :paymentOutstanding"),
    @NamedQuery(name = "PosMasterPayment.findByPaymentTimestamp", query = "SELECT p FROM PosMasterPayment p WHERE p.paymentTimestamp = :paymentTimestamp")})
public class PosMasterPayment implements Serializable {
    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "payment_id")
    private Integer paymentId;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "payment_debit")
    private BigDecimal paymentDebit;
    @Column(name = "payment_kredit")
    private BigDecimal paymentKredit;
    @Column(name = "payment_deposit")
    private BigDecimal paymentDeposit;
    @Column(name = "payment_outstanding")
    private BigDecimal paymentOutstanding;
    @Column(name = "payment_timestamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date paymentTimestamp;
    @JoinColumn(name = "payment_unit_id", referencedColumnName = "unit_id")
    @ManyToOne(optional = false)
    private MasterUnit paymentUnitId;

    public PosMasterPayment() {
    }

    public PosMasterPayment(Integer paymentId) {
        this.paymentId = paymentId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getPaymentId() {
        return paymentId;
    }

    public void setPaymentId(Integer paymentId) {
        this.paymentId = paymentId;
    }

    public BigDecimal getPaymentDebit() {
        return paymentDebit;
    }

    public void setPaymentDebit(BigDecimal paymentDebit) {
        this.paymentDebit = paymentDebit;
    }

    public BigDecimal getPaymentKredit() {
        return paymentKredit;
    }

    public void setPaymentKredit(BigDecimal paymentKredit) {
        this.paymentKredit = paymentKredit;
    }

    public BigDecimal getPaymentDeposit() {
        return paymentDeposit;
    }

    public void setPaymentDeposit(BigDecimal paymentDeposit) {
        this.paymentDeposit = paymentDeposit;
    }

    public BigDecimal getPaymentOutstanding() {
        return paymentOutstanding;
    }

    public void setPaymentOutstanding(BigDecimal paymentOutstanding) {
        this.paymentOutstanding = paymentOutstanding;
    }

    public Date getPaymentTimestamp() {
        return paymentTimestamp;
    }

    public void setPaymentTimestamp(Date paymentTimestamp) {
        this.paymentTimestamp = paymentTimestamp;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (paymentId != null ? paymentId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosMasterPayment)) {
            return false;
        }
        PosMasterPayment other = (PosMasterPayment) object;
        if ((this.paymentId == null && other.paymentId != null) || (this.paymentId != null && !this.paymentId.equals(other.paymentId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.buanalintas.sandals.pos.entities.PosMasterPayment[ paymentId=" + paymentId + " ]";
    }
    
}
